﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PegasCompany.Data;
using PegasCompany.Tools;

namespace PegasCompany
{
    public partial class Default : System.Web.UI.Page
    {
        private SiteContent GetContent(EnumHelper.ContentType targetContent)
        {
            List<SiteContent> sc = SiteContent.ListAllContent((int)targetContent);
            if (sc != null && sc.Count > 0)
            {
                return sc.SingleOrDefault();
            }
            return null;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                SiteContent mainContent = GetContent(EnumHelper.ContentType.Main);
                if (mainContent != null)
                {
                    lMainContentTitle.Text = mainContent.Title;
                    lMainContent.Text = mainContent.Content;
                }
            }
        }
    }
}